﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Fuzzy
{
    public partial class newfile : Form
    {
        public newfile()
        {
            InitializeComponent();
        }

        private void newfilebox_TextChanged(object sender, EventArgs e)
        {
            create_button.Enabled = true;
            if (string.IsNullOrEmpty(newfile_textbox.Text))
                create_button.Enabled = false;
        }

        private void cancel_button_Click(object sender, EventArgs e)
        {
            this.Hide();
            mainform.Enabled = true;
            mainform.BringToFront();

        }

        //THIS FUNCTION WILL TAKE REFRENCE OF MAIN FORM i.e. PARENT FORM
        public void setMainForm(main refrence_form)
        {
            mainform = refrence_form;
        }

        private void create_button_Click(object sender, EventArgs e)
        {
            folderBrowserDialog1.Reset();
            folderBrowserDialog1.ShowDialog();
            if (!string.IsNullOrEmpty(folderBrowserDialog1.SelectedPath.ToString()))
            {
                path = folderBrowserDialog1.SelectedPath + "\\" + newfile_textbox.Text;
                
                this.Hide();
                mainform.setNewPath(path);
                mainform.Enabled = true;
                mainform.BringToFront();
            }           
        }
        public string returnpath()
        {
            return path;
        }

     
    }
}
